function HandleContainerWorkers(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._popupBox = new PopupBox();
  this._popupBox2 = new PopupBox2();
  
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : [];
  this._purchases = (options && options.purchases) ? options.purchases : [];
  this._parent = (options && options.parent) ? options.parent : null;

  this._backup = MiscUtils.clone(this._item);
  
  this._createElements();
}

HandleContainerWorkers.prototype._createElements = function() {
  var balance, _self = this;
  
  var ptotal = 0, vtotal = 0;
  for (var i = 0, il = _self._item.length; i < il; i++) {
    var tmp = _self._item[i];
    if (tmp.pi_model == Constant.MODEL_NAME_USER_PHOTOGRAPHER) {
      ptotal++;
    } else if (tmp.pi_model == Constant.MODEL_NAME_USER_VIDEOGRAPHER) {
      vtotal++;
    }
  }
  if (this._parent.disposalstatus == 1 || this._parent.finished == 1) {
    this._gui.edit.style.display = 'none';
  }
  this._gui.edit.onclick = function() { var func1 = function() { balance = DlmanageUtils.balance(_self._purchases, _self._item);
                                                                 popup = false;
                                                                 for (var i = 0, il = _self._item.length; i < il; i++) {
                                                                   var p = _self._item[i];
                                                                   if (p.estimates == 0 && p.extras == 0) {
                                                                     popup = true;
                                                                   }
                                                                 }
                                                                 var str = '';
                                                                 if (balance.photo != 0 || balance.video != 0 || balance.travel < 0) {
                                                                   str += 'Allocation error,';
                                                                 }
                                                                 if (popup) {
                                                                   str += (str == '') ? '工作人员的时间不能都为0小时,' : '';
                                                                 }
                                                                 if ((balance.photo != 0 && ptotal != 0) || (balance.video != 0 && vtotal != 0) || popup  || balance.travel < 0) {
                                                                   window.alert(str.substring(0, str.length - 1));
                                                                   return;
                                                                 }
                                                                 _self._popupBox2._close();
                                                                 _self._callbackFunc();
                                                               };
                                        var div = document.createElement('div');
                                        var pos = DOMUtils.findPos(this);
                                        pos = [pos[0] - 500, pos[1]];
                                        MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, {t: 'PV Balance', width: 680, height: 50});
                                        var iContainerWorkersEdit = new IContainerWorkersEdit(div, _self._item, { callbackFunc: function() { iContainerWorkersEdit._createElements(); }, purchases: _self._purchases });
                                      };
  
  MiscUtils.sort(this._item, ['title']);
  for (var i = 0, il = this._item.length; i < il; i++) {
    var produce = this._item[i];
    var gproduce = this._gui.users[i];
    
    gproduce.title.style.fontWeight = 'bold';
    gproduce.title.appendChild(document.createTextNode(produce.title));
    if (produce.pi_model == Constant.MODEL_NAME_USER_PHOTOGRAPHER) {
      if (!produce.pi_selects) {
        produce.pi_selects = [];
      }
      if (produce.pi_selects.length == 1) {
        if (produce.pi_selects[0].value != '0' && produce.pi_selects[0].value != '') {
          gproduce.title.appendChild(document.createTextNode(' + ' + produce.pi_selects[0].value + ' ' + produce.pi_selects[0].title + 's'));
        }
      }
    }
    
    gproduce.worker.appendChild(document.createTextNode((produce) ? produce.user_account : ''));
    gproduce.estimates.appendChild(document.createTextNode(produce.estimates));
    gproduce.extras.appendChild(document.createTextNode(produce.extras));
    gproduce.travel.appendChild(document.createTextNode(produce.travels));
  }
  
  balance = DlmanageUtils.balance(this._purchases, this._item);
  if ((balance.photo && ptotal) || (balance.video && vtotal)) {
    var func1 = function() { balance = DlmanageUtils.balance(_self._purchases, _self._item);
                             popup = false;
                             for (var i = 0, il = _self._item.length; i < il; i++) {
                               var p = _self._item[i];
                               if (p.estimates == 0 && p.extras == 0) {
                                 popup = true;
                               }
                             }
                             var str = '';
                             if (balance.photo != 0 || balance.video != 0 || balance.travel < 0) {
                               str += 'Allocation error,';
                             }
                             if (popup) {
                               str += (str == '') ? '工作人员的时间不能都为0小时,' : '';
                             }
                             if ((balance.photo != 0 && ptotal != 0) || (balance.video != 0 && vtotal != 0) || popup || balance.travel < 0) {
                               window.alert(str.substring(0, str.length - 1));
                               return;
                             }
                             _self._popupBox2._close();
                             _self._callbackFunc();
                           };
    var div = document.createElement('div');
    var pos = DOMUtils.findPos(this._gui.edit);
    pos = [pos[0] - 500, pos[1]];
    MiscUtils.dialog(_self._popupBox2, pos, div, func1, null, {t: 'PV Blance', width: 680, height: 100});
    var iContainerWorkersEdit = new IContainerWorkersEdit(div, _self._item, { callbackFunc: function() { iContainerWorkersEdit._createElements(); }, purchases: _self._purchases });
  }
};